/****************************************************************
 * I am the AC 130 vs Pirate game. I allow the user to control an 
 * AC130 gunship in the hunt for Modern day pirates. The player  
 * will be allowed to roam free across a section of ocean/coastline.  
 * In the water there will be four types of vessels: Merchant  
 * ships that the player must protect, Pirate ships that the player  
 * must identify and destroy, Fishing boats that look like Pirate  
 * ships that the player must not destroy, and Friendly Navy ships  
 * that can capture pirates for extra points. Time permitting there  
 * may also be ground targets to attack. 
 *
 * Key elements of this project will be the Player/AC130, the Ships,  
 * the ShipAI system, the collision grid, the debris controller, the  
 * Ground/Water, Clouds, and scoring system. This project will make  
 * use of an external text file to store useful game parameters,  
 * thus allowing us to play balance the game without recompiling  
 * the executable. 
 *****************************************************************
 * I am the Plane Class. I contain all the data needed to Control
 * and Render a single Plane in the game world. The Player will control
 * the plane with the Mouse and Keyboard. Each Plane will have a
 * type and attributes set by that type. All playable aircraft will
 * be an instance of this class so
 *****************************************************************/

#include "Camera.h"
#include "GameData.h"
#include "BulletCtrl.h"
#include <allegro.h>

#ifndef __PLANE_H__
#define __PLANE_H__

#define PLANEMAXANIM 10

class Plane {
public:
		// external references
	GameData * gd;
	BulletCtrl * myBulletCtrl;
		// not implimented
	// CrashBin * myCrashBin;
	// ShipCtrl * myShipCtrl;
	// BulletCtrl * 
		// physical data
	Point * center;
	Point * heading;
	Point * aim;
	Point * helper;
	float speed;
	float strafe;
	float angle;
	float turnRate;
		// input toggles
	bool inLeft;
	bool inRight;
	bool inUp;
	bool inDown;
	bool inLstrafe;
	bool inRstrafe;
	bool inShoot;

		// animation values
	int curPlaneSprite;
	int curTurSprite;
	int curRefire;
	bool isInField;// croshair aim
	
		// play variables loaded from GameData
	float MaxSpeed;
	float MinSpeed;
	float AvgSpeed;
	float DltSpeed;
	float MaxTurn;
	float DltTurn;
	bool canStrafe;	// helicopters only
		// weapon info
	float TurMinAng;
	float TurMaxAng;
	float TurMinRange;
	float TurMaxRange;
	int TurBullet;	// bullet type
	int TurRefire;
	int TurBulPerShot;
	bool TurBlindShot;	// will turret fire if gun is in blind spot
	float TurSprayAng;
	
		// render variables
	int maxPlaneSprite;
	int maxTurSprite;
		
	BITMAP * imgPlane[PLANEMAXANIM];
	BITMAP * imgTurret[PLANEMAXANIM];
	float rendZoom;	// fractional value that causes plane to srink
					// on landing or dieing
	BITMAP * render;	// final output to screen

	

public:
	Plane();
	~Plane();

	void Init(GameData *exGd, BulletCtrl * exBulletCtrl);
	void SetType(char*);	// read plane values from gd

	void Update();
	void UpdateInput();
	void UpdatePosition();
	void UpdateShoot();

	void SetCamera(Camera * cam);
	
	void DrawPlane(Camera * cam);
	void DrawScreen(Camera * cam);

	
};

#endif